/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package base;

import java.util.Vector;
import xmlparser.bugParser;

/**
 *
 * @author pbelov
 */

public class Bug {

    // all items are publiс are temporary.
    private int ID;

    private String title;
    private String description;

    private String project;
    private String device;

    private String assignee;
    private String creator;
    private String tester;

    private String bugVer;
    private String fixVer;

    private int fixNumber;
    private int priority; //1-5
    private int state;

    private int reopenCounter = 0;

    public static int counter = 0;

    private Vector comments = new Vector();

    public void setID(int ID) {
        this.ID = ID;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setDevice(String device) {
        this.device = device;
    }

    public void setProject(String project) {
        this.project = project;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public void setAssignee(String assignee) {
        this.assignee = assignee;
    }

    public void setTester(String tester) {
        this.tester = tester;
    }

    public void setBugVer(String bugVer) {
        this.bugVer = bugVer;
    }

    public void setFixVer(String fixVer) {
        this.fixVer = fixVer;
    }

    public void setFixNumber(int fixNumber) {
        this.fixNumber = fixNumber;
    }

    public void setPriority(int priority) {
        if (priority > 0) {
            this.priority = priority;
        } else {
            this.priority = -1; // invalid priority
        }
    }

    public void setState(int state) {
        if (state >= 0) {
            this.state = state;
        } else {
            this.state = -1; //invalid state
        }
    }

    public void setReopenCount(int count) {
        reopenCounter = count;
    }

    public void increaseReopen() {
        reopenCounter++;
    }

   public int getID() {
        return ID;
    }

    public String getTitle() {
        return title;
    }

    public String getDescription() {
        return description;
    }

    public String getDevice() {
        return device;
    }

    public String getProject() {
        return project;
    }

    public String getCreator() {
        return creator;
    }

    public String getAssignee() {
        return assignee;
    }

    public String getTester() {
        return tester;
    }

    public String getBugVer() {
        String res = "-1";

        if (bugVer != null) {
            res = bugVer;
        }

        return res;
    }

    public String getFixVer() {
        String res = "-1";

        if (fixVer != null) {
            res = fixVer;
        }

        return res;
    }

    public int getFixNumber() {
        return fixNumber;
    }

    public int getPriority() {
        return priority;
    }

    public int getState() {
        return state;
    }

    public int getCommentsCount() {
        return comments.size();
    }

    public Comment getComment(int i) {
        return (Comment)comments.elementAt(i);
    }

    public int getReopenCount() {
        return reopenCounter;
    }

    public void addComment(Comment com) {
        comments.add(com);
    }
}